There are several peripheral devices to a computer used for storing data, such as hard disk drives and floppy disk drives. Hard disk drives can be erased and programmed (written to) many times and, typically, can store a large amount of data. Floppy disk drives also can be erased and written to or programmed many times, but, typically, store a smaller amount of data. Another peripheral storage device used to store data is a Read Only Memory (ROM). A ROM is a solid state memory device that can be programmed only once and then read many times.
Recently, another solid state memory device, flash memory, has been developed for use as a storage medium. In order to use flash memory as a storage medium, a flash file system is used to manage the flash memory and to interface with the operating system of the host. Flash memory can be programmed and electrically erased many times. Typically, flash memory is erased using either a block erase or a chip erase process. When a block erase process is employed, areas of a flash memory chip array, called blocks, are simultaneously erased. When a chip erase process is employed individual chips are erased one at a time. In the following description, when referring to erasing an area of flash memory, the term block erase will be used.
While flash memory is a memory media that can be reprogrammed, prior to writing new data to a memory location that previously held data, the entire block that includes that memory location typically is erased to either an all 0 or an all 1 state. The only time erasing to an all 0 or all 1 state is not required prior to programming new data is when programming only involves changes from 1s to 0s in the all 1 state or from 0s to 1s in the all 0 state. The all 0 or all 1 state is referred to as the erased state and depends on the type of flash memory being used. The erasing of an entire block may take from several tens of milliseconds to several seconds. Furthermore, each time flash memory is erased and rewritten, the flash memory deteriorates. Once flash memory deteriorates to the point where the memory is no longer reliable or able to store data, that area of the flash memory is considered bad. Flash memory may be manufactured with bad areas and may develop bad areas for several other reasons well known to those familiar with flash memory.
Various methods of managing bad areas of flash memory have been proposed. One method copies control information describing the state of the flash memory from the flash memory into a RAM before erasing the flash memory area. After the flash memory area is erased, the control information is written back to the flash memory. This approach has the disadvantage that control information temporarily stored in the RAM is lost if a system failure, such as a power failure, occurs during erasure of the flash memory. The lost information is not recoverable. Another proposed method employs a separate controller and a more reliable secondary memory, such as an EEPROM. This method of managing the flash memory has the disadvantage of requiring extensive support hardware, which adds complexity and expense to the system employing the flash memory.
In summary, a need exists for a method of managing bad areas of flash memory such that information is reliably stored in the flash memory that does not require the use of extensive hardware. The invention is directed to fulfilling this need.